<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../css/mui.min.css">
		<script src="../js/mui.min.js"></script>
		<script src="../js/app.js"></script>
		<style>
			html,body {
				background-color: #efeff4;
			}
		</style>
		<script>
			mui.init();
		</script>
	</head>

	<body>

<header class="mui-bar mui-bar-nav">
	<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	<h1 class="mui-title">上拉加载</h1>
</header>
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
	<div class="mui-scroll">
		<ul class="mui-table-view mui-table-view-chevron">

		</ul>
	</div>
</div>
<script>
	mui.init({
		swipeBack: false,
		pullRefresh: {
			container: '#pullrefresh',
			up: {
				contentdown: '上拉显示更多',
				contentrefresh: '正在加载...',
				callback: pullupRefresh
			}
		}
	});
	var count = 0;
	/**
	 * 上拉加载具体业务实现
	 */
	function pullupRefresh() {
			var self = this;
			setTimeout(function() {
				self.endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
				var table = document.body.querySelector('.mui-table-view');
				var cells = document.body.querySelectorAll('.mui-table-view-cell');
				for (var i = cells.length, len = i + 15; i < len; i++) {
					var li = document.createElement('li');
					li.className = 'mui-table-view-cell';
					li.innerHTML = '<a class="mui-navigate-right">Item ' + (i + 1) + '</a>';
					table.appendChild(li);
				}
			}, 600);
		}
		//页面初始化时，自动执行一次上拉加载
		(function($) {
			if ($.os.plus && $.os.android) {
				$.ready(function() {
					$.plusReady(function() {
						$('#pullrefresh').pullRefresh().pullupLoading();
					});
				})

			} else {
				$.ready(function() {
					$('#pullrefresh').pullRefresh().pullupLoading();
				});
			}
		})(mui);
</script>
</body>
</html>